//
//  YTask.h
//  mcf
//
//  Created by yuike6 yuike6 on 12-1-18.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YTaskDef.h"
@class YTaskResult;

@protocol YTaskDelegate;
@interface YTask : NSOperation
{
    NSString * _name;
    YTaskResult * _result;
    
    BOOL bNeedStop;
    
    YTaskStatus _status;    
    BOOL suspend_task;
    
    id<YTaskDelegate> task_delegate_;
}

@property(nonatomic, copy) NSString * name;
@property(nonatomic, retain) YTaskResult * result;

@property (nonatomic, assign) BOOL bNeedStop;
@property (nonatomic, assign, getter = isSuspended) BOOL suspendTask;

@property (nonatomic, assign) YTaskStatus status;
@property (nonatomic, assign) id<YTaskDelegate> taskDelegate;

- (BOOL) run;
- (void) stop;

-(BOOL) taskBeforeRun;
-(BOOL) taskAfterRun;

@end

@protocol YTaskDelegate <NSObject>
- (void) taskBeforeRun :(YTask *) task;
- (void) taskAfterRun  :(YTask *) task;
@end
